#include <trax.hpp>

namespace AtomTrace{

    const Vector3 & Vector3::LoadFromGM(int address)
    {
        _x = loadf(address, 0);
        _y = loadf(address, 1);
        _z = loadf(address, 2);

        return *this;
    }

    const Vector3 LoadVectorFromGM(int address)
    {
        return Vector3(loadf(address, 0), 
                       loadf(address, 1), 
                       loadf(address, 2));
    }

    void Vector3::SaveToGM(int addr)
    {
        storef(_x, addr, 0);
        storef(_y, addr, 1);
        storef(_z, addr, 2);
    }
    
    void Vector3::SaveToGM(int addr) const
    {
        storef(_x, addr, 0);
        storef(_y, addr, 1);
        storef(_z, addr, 2);
    }

    void Vector3::SetZero()
    {
        _x = _y = _z = 0.0f;
    }

    void Vector3::SetUnitX()
    {
        _x = 1.0f;
        _y = 0.0f;
        _z = 0.0f;
    }

    void Vector3::SetUnitY()
    {
        _x = 0.0f;
        _y = 1.0f;
        _z = 0.0f;
    }

    void Vector3::SetUnitZ()
    {
        _x = 0.0f;
        _y = 0.0f;
        _z = 0.0f;
    }

} // namespace AtomTrace
